package com.example.administrator.myapplication;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

public class BoxAdapter extends BaseAdapter {
    private Context mContext;
    private  LayoutInflater layoutInflater;
    private  ArrayList<BoxPowerList> data=new ArrayList<>();
    public BoxAdapter(Context context) {
        this.mContext=context;
        layoutInflater=LayoutInflater.from(mContext);
    }
    public void setData(ArrayList<BoxPowerList> lists){
        Log.i("123123123","========================================================"+lists.size());
        this.data.clear();
        this.data.addAll(lists);
        Log.i("123123123","========================================================"+data.size());
        notifyDataSetChanged();
    }
    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        viewHolder viewHolder;
        viewHolder=new viewHolder();
        if (convertView==null){
            convertView=layoutInflater.inflate(R.layout.activity_merchandise,null);
            viewHolder.mTast=convertView.findViewById(R.id.tast1);
            convertView.setTag(viewHolder);
        }else {
            viewHolder= (viewHolder) convertView.getTag();
        }
        viewHolder.mTast.setText(this.data.get(position).sku_name);
        return convertView;
    }
    public class viewHolder{
        TextView mTast;

    }
}
